package com.easy.dfc.web;

import com.easy.common.bean.Result;
import com.easy.common.constant.EnumConfig;
import com.easy.core.web.BaseController;
import com.easy.dfc.service.UserDfcService;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.annotation.Resource;

@Controller
@RequestMapping(value = "${apiPath}/user")
public class UserDfcController extends BaseController {


    @Resource
    private UserDfcService userDfcService;



    /**
     * 登录
     * @param mobile
     * @param password
     * @param model
     * @return
     */
    @ResponseBody
    @RequestMapping(value = "Login", method = RequestMethod.POST)
    public Result Login(@RequestParam String mobile, @RequestParam String password, Model model) {
        try {
            return userDfcService.Login(mobile,password);
        } catch (Exception e) {
            Result rt = new Result();
            rt.setStatus(EnumConfig.S_CODE.DB_ERROR);
            return rt;
        }
    }

}
